<%@ taglib prefix="page" uri="http://com.qipay/pagelib" %>
<%@ page language="java" import="com.qipay.admin.utils.SiteHelper" contentType="text/html;charset=utf-8" %>

<%@ page import="com.qipay.baas.model.SpRonghuiMch" %>
<!doctype html>
<html>
<head>
    <jsp:include page="head.jsp"></jsp:include>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <jsp:include page="nav.jsp"></jsp:include>
    <jsp:include page="left.jsp"></jsp:include>
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Main content -->
        <% SpRonghuiMch spRonghuiMch = (SpRonghuiMch) request.getAttribute("detail");
            boolean isAdd = String.valueOf(request.getAttribute("isadd")).equals("1");
        %>
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="box box-info">
                        <% if (request.getParameter("error")!=null){%>
                        <div class="alert alert-error">
                            入网申请失败。
                        </div>
                        <%}%>
                        <div class="box-header with-border">
                            <h3 class="box-title">编辑入网商户信息</h3>
                        </div>
                        <!-- /.box-header -->
                        <!-- form start -->
                        <form class="form-horizontal" action="save" method="POST" id="doc-vld-msg">
                            <input type="hidden" name="isApply">
                            <input type="hidden" name="id" value="<%= isAdd?"":String.valueOf(spRonghuiMch.getId())%>">
                            <div class="box-body" id="dvContent">

                                <div class="form-group">
                                    <label for="txtname" class="col-sm-2 control-label">渠道名称：</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="txtname" name="channelName" mush="1"
                                               value="厦门仟淼信息咨询服务有限公司PLUS" placeholder="渠道名称">
                                    </div>

                                </div>

                                <div class="form-group">
                                    <label for="txtmerchantName" class="col-sm-2 control-label">商户名称：</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="txtmerchantName" name="merchantName"
                                               mush="1"
                                               value="<%= isAdd?"":spRonghuiMch.getMerchantName()%>" placeholder="商户名称">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="txtmerchantbillname" class="col-sm-2 control-label">签购单显示名称：</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="txtmerchantbillname"
                                               name="merchantBillName" mush="1"
                                               value="<%= isAdd?"":spRonghuiMch.getMerchantBillName()%>"
                                               placeholder="签购单显示名称">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="txtinstallprovince" class="col-sm-2 control-label">安装归属省：</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="txtinstallprovince"
                                               name="installProvince"
                                               mush="1" value="<%= isAdd?"":spRonghuiMch.getInstallProvince()%>"
                                               placeholder="安装归属省">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="txtinstallcity" class="col-sm-2 control-label">安装归属市：</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="txtinstallcity" name="installCity"
                                               mush="1"
                                               value="<%= isAdd?"":spRonghuiMch.getInstallCity()%>" placeholder="安装归属市">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="txtinstallcounty" class="col-sm-2 control-label">安装归属县：</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="txtinstallcounty"
                                               name="installCounty"
                                               mush="1" value="<%= isAdd?"":spRonghuiMch.getInstallCounty()%>"
                                               placeholder="安装归属县">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="txtoperateaddress" class="col-sm-2 control-label">经营地址：</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="txtoperateaddress"
                                               name="operateAddress"
                                               mush="1" value="<%= isAdd?"":spRonghuiMch.getOperateAddress()%>"
                                               placeholder="经营地址">
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label for="txtmerchanttype" class="col-sm-2 control-label">商户类型：</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="txtmerchanttype" name="merchantType"
                                               mush="1" value="<%= isAdd?"":spRonghuiMch.getMerchantType()%>"
                                               placeholder="商户类型">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="txtbusinesslicense" class="col-sm-2 control-label">营业执照号：</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="txtbusinesslicense"
                                               name="businessLicense"
                                               value="<%= isAdd?"":spRonghuiMch.getBusinessLicense()%>"
                                               placeholder="营业执照号">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="txtlegalpersonname" class="col-sm-2 control-label">法人代表姓名：</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="txtlegalpersonname"
                                               name="legalPersonName"
                                               mush="1" value="<%= isAdd?"":spRonghuiMch.getLegalPersonName()%>"
                                               placeholder="法人代表姓名">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="txtlegalpersonid" class="col-sm-2 control-label">法人代表身份证：</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="txtlegalpersonid"
                                               name="legalPersonid"
                                               mush="1" value="<%= isAdd?"":spRonghuiMch.getLegalPersonid()%>"
                                               placeholder="法人代表身份证">
                                    </div>
                                </div>
                                  <div class="form-group">
                                      <label for="txtmerchantpersonname" class="col-sm-2 control-label">商户联系人：</label>
                                      <div class="col-sm-10">
                                          <input type="text" class="form-control" id="txtmerchantpersonname"
                                                 name="merchantPersonName"
                                                 mush="1" value="<%= isAdd?"":spRonghuiMch.getMerchantPersonName()%>"
                                                 placeholder="商户联系人">
                                      </div>
                                  </div>
                                  <div class="form-group">
                                      <label for="txtmerchantpersonphone" class="col-sm-2 control-label">商户联系人电话：</label>
                                      <div class="col-sm-10">
                                          <input type="number" class="form-control" id="txtmerchantpersonphone"
                                                 name="merchantPersonPhone"
                                                 mush="1" value="<%= isAdd?"":spRonghuiMch.getMerchantPersonPhone()%>"
                                                 placeholder="商户联系人电话">
                                      </div>
                                  </div>
                                  <%--//可不传，若传则唯一--%>
                                  <div class="form-group">
                                      <label for="txtmerchantpersonemail" class="col-sm-2 control-label">商户联系人邮箱：</label>
                                      <div class="col-sm-10">
                                          <input type="text" class="form-control" id="txtmerchantpersonemail"
                                                 name="merchantPersonEmail"
                                                 value="<%= isAdd?"":spRonghuiMch.getMerchantPersonEmail()%>"
                                                 placeholder="商户联系人邮箱">
                                      </div>
                                  </div>


                                  <div class="form-group">
                                      <label for="txtbanktype" class="col-sm-2 control-label">结算账户性质：</label>
                                      <div class="col-sm-10">
                                          <input type="text" class="form-control" id="txtbanktype" name="bankType"
                                                 mush="1" value="<%= isAdd?"":spRonghuiMch.getBankType()%>"
                                                 placeholder="结算账户性质">
                                      </div>
                                  </div>
                                  <div class="form-group">
                                      <label for="txtaccountname" class="col-sm-2 control-label">开户名称：</label>
                                      <div class="col-sm-10">
                                          <input type="text" class="form-control" id="txtaccountname" name="accountName"
                                                 mush="1" value="<%= isAdd?"":spRonghuiMch.getAccountName()%>"
                                                 placeholder="开户名称">
                                      </div>
                                  </div>
                                  <div class="form-group">
                                      <label for="txtaccountno" class="col-sm-2 control-label">开户账号：</label>
                                      <div class="col-sm-10">
                                          <input type="number" class="form-control" id="txtaccountno" name="accountNo"
                                                 mush="1" value="<%= isAdd?"":spRonghuiMch.getAccountNo()%>"
                                                 placeholder="开户账号">
                                      </div>
                                  </div>
                                  <div class="form-group">
                                      <label for="txtbankcode" class="col-sm-2 control-label">联行号：</label>
                                      <div class="col-sm-10">
                                          <input type="number" class="form-control" id="txtbankcode" name="bankCode"
                                                 mush="1" value="<%= isAdd?"":spRonghuiMch.getBankCode()%>"
                                                 placeholder="联行号">
                                      </div>
                                  </div>
                                  <div class="form-group">
                                      <label for="txtcreditcardno" class="col-sm-2 control-label">结算人信用卡：</label>
                                      <div class="col-sm-10">
                                          <input type="number" class="form-control" id="txtcreditcardno"
                                                 name="creditCardNo"
                                                 value="<%= isAdd?"":spRonghuiMch.getCreditCardNo()%>"
                                                 placeholder="结算人信用卡">
                                      </div>
                                  </div>
                                <div class="form-group">
                                    <label  hidden for="txtstate" class="col-sm-2 control-label">state：</label>
                                    <div  hidden class="col-sm-10">
                                        <input  type="number" class="form-control" id="txtstate" name="state"
                                               value="<%= isAdd?"":spRonghuiMch.getState().toString()%>" placeholder="state">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label readonly="true" for="txtquerykey" class="col-sm-2 control-label">商户查询密钥：</label>
                                    <div  class="col-sm-10">
                                        <input type="text"  readonly= "true " class="form-control" id="txtquerykey" name="queryKey"
                                               value="<%= spRonghuiMch!=null&&spRonghuiMch.getQueryKey()!=null?spRonghuiMch.getQueryKey():""%>" placeholder="queryKey">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label readonly="true" for="txtdesy" class="col-sm-2 control-label">商户查询密钥：</label>
                                    <div  class="col-sm-10">
                                        <input type="text"  readonly= "true " class="form-control" id="txtdesy" name="desy"
                                               value="<%=spRonghuiMch!=null&&spRonghuiMch.getDesKey()!=null?spRonghuiMch.getDesKey():""%>" placeholder="desy">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label readonly="true" for="txtsignKey" class="col-sm-2 control-label">商户签名加密密钥：</label>
                                    <div  class="col-sm-10">
                                        <input type="text"  readonly= "true " class="form-control" id="txtsignKey" name="signKey"
                                               value="<%= spRonghuiMch!=null&&spRonghuiMch.getSignKey()!=null?spRonghuiMch.getSignKey():""%>" placeholder="signKey">
                                    </div>
                                </div>
                            </div>
                            <!-- /.box-body -->
                            <div class="box-footer">
                                <button type="button" class="btn btn-default" onclick="window.history.back()">返回
                                </button>
                                <%if(spRonghuiMch==null||(spRonghuiMch!=null&&spRonghuiMch.getState()!=null&&spRonghuiMch.getState()!=0)) {%>
                                <button style='width:50px;' type="button"
                                        class="button back-green pull-right" id="saveAndApply">保存并提交申请
                                </button>
                                <button type="button"
                                        class="button back-green pull-right" id="btnSave">保存
                                </button>
                                <%}%>
                            </div>
                            <!-- /.box-footer -->

                        </form>
                    </div>
                    <!-- /.box -->
                </div>
                <!-- /.col -->
            </div>
            <!-- /.row -->
        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
    <jsp:include page="foot.jsp"></jsp:include>
</div>
<script type="text/javascript"
<script src="<%= request.getAttribute("StaticHost") %>/js/fastclick.js"></script>
<script src="<%= request.getAttribute("StaticHost") %>/js/adminlte.min.js"></script>
<script>
    $(function () {

        $("#btnSave").on("click", function () {

                $("#doc-vld-msg input[name='isApply']").val("false");
                $("#doc-vld-msg")[0].submit();
        })
               /*申请时判断必填项*/
                $("#saveAndApply").on("click", function () {
                    var isGo = checkInputMust("dvContent");
                    if (isGo) {
                        $("#doc-vld-msg input[name='isApply']").val("true");
                        $("#doc-vld-msg")[0].submit();
                    }
                })
    })


</script>
</body>
</html>

